﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GameLibrary.Unit
{
    using Interfaces;

    /// <summary>
    /// Store information about a unit.
    /// </summary>
    [Serializable]
    public class UnitInfo : IInfo,
                            IMapObject
    {
        #region variables

        public Template Template { get; private set; }
        public CurrentAbility Current { get; private set; }
        public uint TimeStamp { get; private set; }

        #endregion

        #region constructor

        public UnitInfo()
            : base(0, Position.Zero, 0)
        {
            this.Template = Template.DefaultSoldier;
            this.Current = new CurrentAbility(0, 0, 0, 0, 0);
        }

        public UnitInfo(Unit unit)
            : base(unit.ID, unit.Location, unit.OwnerID)
        {
            Template = unit.Template;
            Current = new CurrentAbility(unit.Current);
            TimeStamp = GameManager.TurnNumber;
        }

        public UnitInfo(UnitInfo info)
            : base(info)
        {
            this.Template = info.Template;
            this.Current = new CurrentAbility(info.Current);
            this.TimeStamp = info.TimeStamp;
        }

        #endregion

        #region get total cost

        public uint GetTotalCost()
        {
            return this.Template.Cost;
        }

        #endregion
    }
}
